package com.cjjd.c.http;

import com.cjjd.c.bean.RequestBean;
import com.cjjd.c.utils.LogUtil;
import com.google.gson.Gson;

import java.util.HashMap;

/**
 * ----------------------------------
 * Created by xyd on 2017/8/25.
 * <p/>
 * 描  述：请求参数生成器
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class RequestCreator {

    /**
     * 生成请求参数
     *
     * @param openType
     * @param hashMap
     * @return
     */
    public static String create(String openType, HashMap<String, String> hashMap) {
        String s = "";
        RequestBean requestBean = new RequestBean();
        requestBean.map = new HashMap<>();
        if (hashMap != null) {
            requestBean.map.putAll(hashMap);
        }
        if (openType == null) {
            requestBean.opeType = "";
        } else {
            requestBean.opeType = openType;
        }
        Gson gson = new Gson();
        s = gson.toJson(requestBean);
        LogUtil.e("xyd", "请求参数是： " + s);
        return s;
    }
}
